package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpInventoryPrintQueuePageUtil extends SeleniumPageUtil {
	
	public final static By IPQ_SPAN_HEADER = By.id("ctl46_lblHdr");
	public final static By IPQ_SPAN_UPDATE_TIME = By.id("ctl46_lblLastUpdate");
	public final static By IPQ_IMG_HELP = By.xpath("//*[@id='ctl46_imgHelpLink']/img");
	public final static By IPQ_SELECT_WAREHOUSES = By.id("ctl46_cboWarehouse");
	public final static By IPQ_TH_DESCRIPTION = By.xpath("//*[@id='ctl46_lblPrintServers']/table/tbody/tr[1]/th[3]");
	public final static By IPQ_TH_SERVER_ID = By.xpath("//*[@id='ctl46_lblPrintServers']/table/tbody/tr[1]/th[4]");
	public final static By IPQ_TH_INSTALLED_DATE = By.xpath("//*[@id='ctl46_lblPrintServers']/table/tbody/tr[1]/th[5]");
	public final static By IPQ_TH_LAST_CHECK_IN = By.xpath("//*[@id='ctl46_lblPrintServers']/table/tbody/tr[1]/th[6]");
	public final static By IPQ_TH_VERSION = By.xpath("//*[@id='ctl46_lblPrintServers']/table/tbody/tr[1]/th[7]");
	public final static By IPQ_TD_TEST = By.xpath("//*[@id='ctl46_lblPrintServers']/table/tbody/tr[2]/td[1]");
	public final static By IPQ_TD_EDIT = By.xpath("//*[@id='ctl46_lblPrintServers']/table/tbody/tr[2]/td[2]");
	public final static By IPQ_SPAN_SHOW_UNALLOCATED_SERVERS = By.id("ctl46_lblShowUnallocated");
	public final static By IPQ_PRINT_RESULT = By.id("ctl46_lblResults");
	public final static By IPQ_TH_PRINT_SERVER = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr[1]/th[1]");
	public final static By IPQ_TH_PRINTER = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr[1]/th[2]");
	public final static By IPQ_TH_USER = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr[1]/th[3]");
	public final static By IPQ_TH_DESCRIPTION_RESULTS = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr[1]/th[4]");
	public final static By IPQ_TH_PAGES = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr[1]/th[5]");
	public final static By IPQ_TH_DATE_ADDED = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr[1]/th[6]");
	public final static By IPQ_TH_DATE_SENT = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr[1]/th[7]");
	public final static By IPQ_TH_DATE_COMPLETE = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr[1]/th[8]");
	public final static By IPQ_TH_STATUS = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr[1]/th[9]");
	public final static By IPQ_TH_OPTIONS = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr[1]/th[10]");
	public final static By IPQ_SPAN_RESUME = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr[3]/td[10]/span[1]");
	public final static By IPQ_SPAN_CANCEL = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr[3]/td[10]/span[2]");
	public final static By IPQ_SPAN_ROUTE = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr[3]/td[10]/span[3]");
	public final static By IPQ_TD_TOTAL_JOBS = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr[4]/td[2]");
	public final static By IPQ_TD_TOTAL_JOBS_NO = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr[4]/td[3]");
	
	// preview tags printed by print inventory tags
	public final static By IPQ_TR_RESULTS = By.xpath("//*[@id='ctl46_lblResults']/table/tbody/tr");
	
	public static void enterInventoryPrintQueuePage() {
		SpHomePageUtil.enter();
		SpHomePageUtil.enterInventoryQueuePage();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				IPQ_IMG_HELP, IPQ_SELECT_WAREHOUSES
			});
		
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IPQ_IMG_HELP));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(IPQ_SELECT_WAREHOUSES));
	}
}
